<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        table{
            border-collapse: collapse;
        }
        td{
            border: 1px solid #000;
        }
        .active{
            background-color: red;
        }
    </style>
</head>
<body>
    <div id="app">
        <h1>请选择你的登录方式</h1>
        <router-link to="/password">账号名密码</router-link>
        <router-link to="/char">二维码</router-link>
        <router-view></router-view>
    </div>
    <template id="password">
        <div>
            <h2>输入信息</h2>
            <table>
                <tr>
                    <td>用户名</td>
                    <td><input type="text"></td>
                </tr>
                <tr>
                    <td>密码</td>
                    <td><input type="text"></td>
                </tr>
                <tr>
                    <td>重复密码</td>
                    <td><input type="text"></td>
                </tr>
                <tr>
                    <td>验证码</td>
                    <td><input type="text"></td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align: center;"><button>注册新用户</button></td>
                </tr>
            </table>
        </div>
    </template>
    <template id="char">
        <div>
            <h2>扫码</h2>
            <img src="./char.jpg" alt="">
        </div>
    </template>
</body>
<script src="./vue.js"></script>
<script src="./vue-router.js"></script>
<script>
    let password = {
        template: "#password"
    }

    let char = {
        template: "#char"
    }

    const routerObj = new VueRouter({
        routes: [
            {path: "/password", name: "password", component: password},
            {path: "/char", name: "char", component: char}
        ],
        linkActiveClass: "active"
    })

    let vm = new Vue({
        el: "#app",
        router: routerObj
    })
</script>
</html>